package com.zz.ecommerce.togatherDeclareMgr.custDeclarationUpload;

import com.zz.ecommerce.togatherDeclareMgr.custDeclarationUpload.bean.MsgDecHistory;
import com.zz.ecommerce.togatherDeclareMgr.custDeclarationUpload.service.DecStatusService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 报关报检状态查询controller
 *
 * @author STEVEN
 * @date 2015/9/18,16:49
 */
@Controller
@RequestMapping("/decStatus")
public class DecStatusController {

    private final Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    private DecStatusService decStatusService;

    /**
     * 报关单状态信息页面初始化
     *
     * @return
     */
    @RequestMapping(value = "/toCustStatusPage")
    public String toCustStatusPage(ModelMap modelMap,
                                   @RequestParam(value = "indx", required = true) String indx,
                                   @RequestParam(value = "conIndx", required = true) String conIndx,
                                   String statusProcess) {
        try {
            List<MsgDecHistory> list = null;
            if (StringUtils.isNotEmpty(conIndx)) {
                MsgDecHistory status = new MsgDecHistory();
                status.setClientSeqNo(conIndx);
                list = decStatusService.queryCustDecStatusList(status);
            }
            modelMap.put("list", list);
            modelMap.put("indx", indx);
            modelMap.put("statusProcess", statusProcess);
        } catch (Exception e) {
            logger.error("ERROR:StatusController#toCustStatusPage,detail >>>>", e);
        }
        return "/togatherDeclareMgr/custDeclarationUpload/exportCust/decCustStatus";
    }

}
